package kr.hkit.javaproject.chapter00;

public class Lotte {
	private int ticket;
	private int age;
	private int time;

	public Lotte(int ticket, int age, int time) {
		this.ticket = ticket;
		this.age = age;
		this.time = time;
	}

	public void setData(int ticket, int age, int time) {
		this.ticket = ticket;
		this.age = age;
		this.time = time;
	}

	public int getPrice() {
		int price = 0;
		if (this.ticket == 1) {								//자유이용권
			if (time < 17) {								//주간(17시 이전)
				if (age < 3) {								//유아
					price = 0;
				} else if (age < 13 || age > 64) {			//소인
					price = 25000;
				} else {									//대인
					price = 34000;
				}
			} else {
				if (time >= 17) {							//야간(17시 이후)
					if (age < 3) {							//유아
						price = 0;
					} else if (age < 13 || age > 64) {		//소인
						price = 21000;
					} else {								//대인
						price = 29000;
					}
				}
			}
		} else {											//입장권
			if (time < 17) {								//주간
				if (age < 3) {								//유아
					price = 0;
				} else if (age < 13 || age > 64) {			//소인
					price = 20000;
				} else {									//대인
					price = 27000;
				}
			} else {
				if (time >= 17) {							//야간
					if (age < 3) {							//유아
						price = 0;
					} else if (age < 13 || age > 64) {		//소인
						price = 17000;
					} else {								//대인
						price = 23000;
					}
				}
			}
		}
		return price;
	}

	@Override
	public String toString() {
		return "Lotte [ticket=" + ticket + ", age=" + age + ", time=" + time
				+ ", getPrice()=" + getPrice() + "]";
	}
}
